
#include <stdio.h>
#include  "gw_ktj_api_config.h"
//#include "Node95.h"

#include "gui_cjson_api.h"
#include "gui_logist.h"
#include "print_log.h"
#include "string.h" 

#include  "meter.h" 




 MeterData_st    MeterData;
 MeterConfig_st  meter_config;

// ele_meter ??? ConcentorSendAlarmtoSever(void) ?? 
//ELE_METER ele_meter;



void  Meter_Init(void)
{

    memset((uint8_t*)&MeterData,0,sizeof(MeterData_st) );	
	MeterData.CT = 1;
	MeterData.VT = 1;	
	

    memset((uint8_t*)&meter_config,0,sizeof(MeterConfig_st) );		
	
}



void  Meter_Tick(void)
{

    log_debug("%s\n",__FUNCTION__);

#if 0
	if( (Node_Get_Meter_pid(  PID_RS485_METER_STR_3PH,  &meter_config ) >0 )  ||\
		(Node_Get_Meter_pid(  PID_RS485_METER_STR_1PH,  &meter_config ) >0 )   )
	{
	  // 读取外接电表数据
		json_read_RS485_meter( get_gateway_id() ,  &meter_config ) ;

	}
#endif

}




//比较两个电表是否匹配  相等返回>0;不相等返回0，出错返回<0
int8_t Meter_is_pid_eq( MeterConfig_st* ma,MeterConfig_st* mb )
{

   if( (NULL==ma) ||  ( NULL==mb)  )  
    {
         return -1;   // error 			
	}



   if( ( ma->nodeType == mb->nodeType ) && ( ma->channel == mb->channel )&&\
       ( ma->privAddr == mb->privAddr ) )    
	{
          if( 0==strcmp( ma->deviceName,ma->deviceName ) )
		  { //若str1=str2，则返回零
             return 1;//findit

		  }else{
             return 0;   // not find 			
		  }


	}else{

      return 0;   // not find 			
		
	}


}






void  MeterDataUpdate(void)
{

}







